<?php
/**
 * Created by PhpStorm.
 * User: dt
 * Time: 16:53
 */
namespace yanse\base;
use Yii;
use common\base\BController;



/**
 * 控制器基类
 * @package app\base
 */
class BaseController extends BController
{

    public function beforeAction($action){
        $this->body();
        $this->saveUserIp(6);
        return true;
    }

    /**
     * 设置全局视图参数
     */
    protected function setViewParams($title,$keyword,$desc)
    {
        if(Yii::$app->request->isAjax){
            return true;
        }
    	$title = Yii::$app->params['webname'][Yii::$app->request->hostInfo].'-'.$title;
        $this->view->title = str_replace('*',$title,'*小说,视频,图片,*[视频下载,在线观看] - *视频网');
        $keywords = str_replace('*',$keyword,$title.'*小说,视频,图片,*[视频下载,在线观看] - *视频网');
        $description = str_replace('*',$desc,$title.'*小说,视频,图片,*[视频下载,在线观看] - *视频网');
        $this->view->params['keywords'] = $keywords;
        $this->view->params['description'] = $description;
    }
}